package com.soilflow.web.controller.dahu;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.soilflow.common.domain.DahuRouteStop;
import com.soilflow.common.domain.dto.DahuRouteStopDto;
import com.soilflow.common.domain.vo.DahuRouteStopVo;
import com.soilflow.info.service.IDahuRouteStopService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.soilflow.common.annotation.Log;
import com.soilflow.common.core.controller.BaseController;
import com.soilflow.common.core.domain.AjaxResult;
import com.soilflow.common.enums.BusinessType;
import com.soilflow.common.utils.poi.ExcelUtil;
import com.soilflow.common.core.page.TableDataInfo;

/**
 * 拼车 Controller
 * 
 * @author party
 * @date 2023-10-30
 */
@RestController
@RequestMapping("/system/routestop")
public class DahuRouteStopController extends BaseController {
    @Autowired
    private IDahuRouteStopService dahuRouteStopService;

    /**
     * 查询全部拼车列表
     */
    @GetMapping("/list")
    public TableDataInfo list(DahuRouteStopVo dahuRouteStopvo) {
        startPage();
        List<DahuRouteStopVo> list = dahuRouteStopService.selectDahuRouteStopList(dahuRouteStopvo);
        return getDataTable(list);
    }

    /**
     * 获取某个拼车详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:stop:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(dahuRouteStopService.selectDahuRouteStopById(id));
    }

    /**
     * 新增【发布拼车信息】
     */
    @PreAuthorize("@ss.hasPermi('system:stop:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DahuRouteStopDto dahuRouteStopdto) {
        return toAjax(dahuRouteStopService.insertDahuRouteStop(dahuRouteStopdto));
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:stop:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DahuRouteStop dahuRouteStop) {

    }
    /**
     * 修改【拼车】
     */
    @PreAuthorize("@ss.hasPermi('system:stop:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DahuRouteStop dahuRouteStop)
    {
        return toAjax(dahuRouteStopService.updateDahuRouteStop(dahuRouteStop));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:stop:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dahuRouteStopService.deleteDahuRouteStopByIds(ids));
    }
}
